<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="text" id="text1">
    <select id="fh">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text"  id="text2">
    <input type="button" value="=" id="btn">
    <input type="text"  id="text3">

</body>
<script>
    //获取元素
    var txt1 = document.getElementById("text1")
    var txt2 = document.getElementById("text2")
    var txt3 = document.getElementById("text3")
    var btn = document.getElementById("btn")
    //点击按钮
    btn.onclick = function(){
        //获取页面运算符号
        var fh = document.getElementById("fh").value
        //选中的符号做实际的加减乘除
        switch(fh){
            case"+":txt3.value = Number(txt1.value)+Number(txt2.value);break;
            case"-":txt3.value = txt1.value-txt2.value;break;
            case"*":txt3.value = txt1.value*txt2.value;break;
            case"/":txt3.value = txt1.value/txt2.value;break;
        }
        
    }
    
</script>
</html>